package com.yoomiito.app.present.account;

import com.yoomiito.app.base.AppConfig;
import com.yoomiito.app.model.bean.BingPhoneBean;
import com.yoomiito.app.base.BaseAccountPresent;
import com.yoomiito.app.ui.account.BindingPhoneActivity;

import cn.droidlover.xdroidmvp.log.XLog;
import cn.droidlover.xdroidmvp.net.ApiException;
import cn.droidlover.xdroidmvp.net.ApiSubscriber;

public class BindingPhonePresent extends BaseAccountPresent<BindingPhoneActivity> {


    private static final String TAG ="BindingPhonePresent";

    public BindingPhonePresent(AppConfig appConfig) {
        super(appConfig);
    }

    /**
     * 请求验证码
     * @param phone 手机号
     */
    public void requestSendCode(String phone){
        sendCode(phone,"86").subscribe(new ApiSubscriber<BingPhoneBean>(handleException()) {
            @Override
            public void onSuccess(BingPhoneBean bingPhoneBean) {
                getV().toPhoneCodeCheckActivity();
            }

            @Override
            public void onFail(ApiException error) {
                XLog.d(TAG,"error:"+error.getMessage());
            }
        });
    }
}
